<%--
  Created by IntelliJ IDEA.
  User: 雷神
  Date: 2021/3/29
  Time: 13:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <base href="<%=basePath%>">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="view/bootstrap-3.3.5/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="view/bootstrapvalidator/css/bootstrapValidator.css" />
    <script charset="utf-8" src="view/jquery/jquery-1.10.2.min.js"></script>
    <script charset="utf-8" src="view/bootstrap-3.3.5/js/bootstrap.js"></script>
    <script charset="utf-8" src="view/bootstrapvalidator/js/bootstrapValidator.js"></script>
</head>
<body>
<!--添加模态框-->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myheadModalLabel">添加资产页面</h4>
            </div>
            <form action="zcset/insert" role="form" class="form-horizontal"
                  id="myform" method="post">
                <div class="modal-body">

                    <div class="form-group">
                        <label class="col-sm-2 control-label">资产类型</label>
                        <div class="col-md-4">
                            <select name="type">
                                <option value="">请选择</option>
                                <c:forEach items="${zctype}" var="t">
                                    <option value="${t.oid}">${t.typeName}</option>
                                </c:forEach>
                            </select>

                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">资产序列号</label>
                        <div class="col-md-4">
                            <input type="text" class="form-control" name="assetNumber"
                                   placeholder="资产序列号">

                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">规格型号</label>
                        <div class="col-md-4">
                            <input type="text" class="form-control" name="guige"
                                   placeholder="规格型号">

                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">资产名称</label>
                        <div class="col-md-4">
                            <input type="text" class="form-control" name="assetNanme"
                                   placeholder="资产名称">

                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">出厂时间</label>
                        <div class="col-md-4">
                            <input type="date" class="form-control" name="produceTime"
                                   placeholder="出厂时间">

                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-2 control-label">存放地点</label>
                        <div class="col-md-4">
                            <select name="depositary">
                                <option value="">请选择存放地点</option>
                                <c:forEach items="${jcbasedd}" var="jcd">
                                    <option value="${jcd.oid}">${jcd.name}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">库管</label>
                        <div class="col-md-4">
                            <select name="keeper">
                                <option value="">请选择库管</option>
                                <c:forEach items="${emp}" var="e">
                                    <option value="${e.oid}">${e.empName}</option>
                                </c:forEach>
                            </select>

                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">单价</label>
                        <div class="col-md-4">
                            <input type="text" class="form-control" name="price"
                                   placeholder="请输入单价">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">入库时间</label>
                        <div class="col-md-4">
                            <input type="date" class="form-control" name="regDate"
                                   placeholder="入库时间">

                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">资产来源</label>
                        <div class="col-md-4">
                            <select name="addType">
                                <option value="">请选择资产来源</option>
                                <c:forEach items="${jcbase}" var="jc">
                                    <option value="${jc.oid}">${jc.name}</option>
                                </c:forEach>
                            </select>

                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">备注</label>
                        <div class="col-md-4">
                            <input type="text" class="form-control" name="remark"
                                   placeholder="请输入备注">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">经办人</label>
                        <div class="col-md-4">
                            <select name="jinban">
                                <option value="">请选择经办人</option>
                                <c:forEach items="${emp}" var="e">
                                    <option value="${e.oid}">${e.empName}</option>
                                </c:forEach>
                            </select>

                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">创建人</label>
                        <div class="col-md-4">
                            <select name="creator" disabled="disabled">
                                <option value="">请选择创建人</option>
                                <c:forEach items="${emp}" var="e">

                                    <c:if test="${sessionScope.empid==e.oid}">
                                    <option value="${e.oid}" selected>${e.empName}</option>
                                    </c:if>
                                    <c:if test="${sessionScope.empid!=e.oid}">
                                        <option value="${e.oid}">${e.empName}</option>
                                    </c:if>
                                </c:forEach>
                            </select>

                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">数量</label>
                        <div class="col-md-4">
                            <input type="text" class="form-control" name="amount"
                                   placeholder="请输入数量">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">状态</label>
                        <div class="col-md-4">
                            <input type="radio" name="status" value="1">使用中
                            <input type="radio" name="status" value="2">闲置的
                            <input type="radio" name="status" value="3">报废的
                        </div>
                    </div>

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit" class="btn btn-primary">添加</button>
                </div>
            </form>
        </div>

    </div>
</div>

<div class="container col-sm-12">
    <%-- 标题--%>
    <div class="panel-heading">
        <h2>固定资产列表</h2>
        <form class="form-horizontal" action="zcset/selecttj" method="post" role="form">
            资产类别：
            <select name="type">
                <option value="">请选择</option>
                <c:forEach items="${zctype}" var="t">
                    <option value="${t.oid} " ${type==t.oid?"selected":"" }>${t.typeName}</option>
                </c:forEach>
            </select>
            资产名称：<input type="text" name="assetNanme" value="${assetNanme}">
            资产编号：<input type="text" name="assetCode" value="${assetCode}">
            <input type="submit" value="搜索">

        </form>
        <button class="btn btn-primary btn-xs pull-right" data-toggle="modal" data-target="#myModal">新建</button>
    </div>

    <div class="panel-body">
        <table class="table table-striped table-hover">
            <thead>
            <tr>
                <th>资产类别</th>
                <th>资产编号</th>
                <th>资产名称</th>
                <th>存放地点</th>
                <th>库管</th>
                <th>资产来源</th>
                <th>创建人</th>
                <th>状态</th>
                <th>是否报销</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <c:if test="${list.size()>0}">
                <c:forEach items="${list}" var="zc">
                    <tr>
                        <td>${zc.zctype.typeName}</td>
                        <td>${zc.assetCode}</td>
                        <td><a data-toggle="modal" data-target="#model${zc.oid}">${zc.assetNanme}</a></td>
                        <td>${zc.jcdd.name}</td>
                        <td>${zc.empkg.empName}</td>
                        <td>${zc.jcly.name}</td>
                        <td>${zc.empcj.empName}</td>
                        <td><c:choose>
                            <c:when test="${zc.status=='1'}">
                                使用中
                            </c:when>
                            <c:when test="${zc.status=='2'}">
                                闲置中
                            </c:when>
                            <c:when test="${zc.status=='3'}">
                                已报废
                            </c:when>
                        </c:choose></td>

                        <td><c:choose>
                            <c:when test="${zc.status=='1'}">
                                <!-- 使用中 -->
                                <a href="zcset/baofei?oid=${zc.oid}&status=2"
                                   class="btn btn-danger btn-xs">报废</a>
                            </c:when>
                            <c:when test="${zc.status=='2'}">
                                <!-- 闲置中 -->
                                <a href="zcset/baofei?oid=${zc.oid}&status=1"
                                   class="btn btn-primary btn-xs">使用</a>
                                <a href="zcset/baofei?oid=${zc.oid}&status=2"
                                   class="btn btn-danger btn-xs">报废</a>
                            </c:when>
                            <c:when test="${zc.status=='3'}">
                                <!-- 已报废 -->
                                已报废
                            </c:when>
                        </c:choose></td>

                        <td><c:choose>
                            <c:when test="${zc.status=='1'}">
                                <!-- 使用中 -->
                                <a href="zcset/toupdate?oid=${zc.oid}"
                                   class="btn btn-info btn-xs">修改</a>
                                <a href="Zcasset/zcyidong?oid=${zc.oid}"
                                   class="btn btn-success btn-xs">移动记录</a>
                            </c:when>
                            <c:when test="${zc.status=='2'}">
                                <!-- 闲置中 -->
                                <a href="zcset/toupdate?oid=${zc.oid}"
                                   class="btn btn-info btn-xs">修改</a>
                                <a href="Zcasset/zcyidong?oid=${zc.oid}"
                                   class="btn btn-success btn-xs">移动记录</a>
                            </c:when>
                            <c:when test="${zc.status=='3'}">
                                <!-- 已报废 -->
                                <a href="zcset/delete?oid=${zc.oid}" class="btn btn-danger btn-xs">删除</a>
                            </c:when>
                        </c:choose></td>
                    </tr>
                </c:forEach>
            </c:if>
            </tbody>
        </table>
    </div>
    <!-- 内容结束-->
</div>
<!-- 面板结束-->
<!-- 显示报销： 结束 -->

</body>
</html>
